package com.system.boot.rbac.converter;

import com.system.api.rbac.entity.dto.RoleFormDto;
import com.system.api.rbac.entity.po.SysRole;
import com.system.api.rbac.entity.search.RoleSearch;
import com.system.api.rbac.entity.vo.RoleListVo;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import org.yang.database.orm.entity.BaseQuery;

import java.util.List;

/**
 * @author: lslands
 * @description:
 * @version：v1.0
 * @date: 2024/6/2 18:45
 */
@Mapper(builder = @org.mapstruct.Builder(disableBuilder = true),componentModel = "spring")
public interface RoleConverter {

    RoleConverter INSTANCE = Mappers.getMapper(RoleConverter.class);
    /**
     * 转换 dtoForm -> po
     * @param formDto 插入对象
     * @return SysDict
     */
    SysRole formEntity(RoleFormDto formDto);


    /**
     * 转换 search -> BaseQuery
     * @param search 搜索对象转换
     * @return BaseQuery
     */
    BaseQuery queryEntity(RoleSearch search);

    /**
     * 转换 search -> po
     * @param search 搜索对象转换
     * @return BaseQuery
     */
    SysRole queryPoEntity(RoleSearch search);

    /**
     * 转换 poList -> voList
     * @param roleList 角色列表集
     * @return List<RoleTreeVo>
     */
    List<RoleListVo> listPoEntity(List<SysRole> roleList);
}
